package cn.iocoder.yudao.module.erp.dal.mysql.dpeast;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpeastlistdx.vo.DpEastListDxPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpEastListDxDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpEastListGzDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 东线口岸仓东线清单 Mapper
 * @author 天使管理员
 */
@Mapper
public interface DpEastListDxMapper extends BaseMapperX<DpEastListDxDO> {

    default PageResult<DpEastListDxDO> selectPage(DpEastListDxPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DpEastListDxDO>()
                .eqIfPresent(DpEastListDxDO::getNo, reqVO.getNo())
                .eqIfPresent(DpEastListDxDO::getTicketNo, reqVO.getTicketNo())
                .eqIfPresent(DpEastListDxDO::getBoxMarking, reqVO.getBoxMarking())
                .likeIfPresent(DpEastListDxDO::getProductName, reqVO.getProductName())
                .eqIfPresent(DpEastListDxDO::getProductInfo, reqVO.getProductInfo())
                .eqIfPresent(DpEastListDxDO::getMaterialRu, reqVO.getMaterialRu())
                .eqIfPresent(DpEastListDxDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(DpEastListDxDO::getQuantityPerBox, reqVO.getQuantityPerBox())
                .eqIfPresent(DpEastListDxDO::getUnit, reqVO.getUnit())
                .eqIfPresent(DpEastListDxDO::getTotal, reqVO.getTotal())
                .eqIfPresent(DpEastListDxDO::getLength, reqVO.getLength())
                .eqIfPresent(DpEastListDxDO::getWidth, reqVO.getWidth())
                .eqIfPresent(DpEastListDxDO::getHigh, reqVO.getHigh())
                .eqIfPresent(DpEastListDxDO::getVolumePerBox, reqVO.getVolumePerBox())
                .eqIfPresent(DpEastListDxDO::getCubem, reqVO.getCubem())
                .eqIfPresent(DpEastListDxDO::getGrossWeightPerBox, reqVO.getGrossWeightPerBox())
                .eqIfPresent(DpEastListDxDO::getGrossWeight, reqVO.getGrossWeight())
                .eqIfPresent(DpEastListDxDO::getNetWeightBox, reqVO.getNetWeightBox())
                .eqIfPresent(DpEastListDxDO::getTotalNetWeight, reqVO.getTotalNetWeight())
                .eqIfPresent(DpEastListDxDO::getPackaging, reqVO.getPackaging())
                .eqIfPresent(DpEastListDxDO::getNotes, reqVO.getNotes())
                .orderByDesc(DpEastListDxDO::getId));
    }

    default List<DpEastListDxDO> selectListByNo(String no) {
        return selectList(DpEastListDxDO::getNo, no);
    }

    default int deleteByNo(String no) {
        return delete(DpEastListDxDO::getNo, no);
    }

}